unit U_fm_pesq_vendedor;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.Grids, Vcl.DBGrids, Vcl.StdCtrls,
  Vcl.Buttons, Vcl.ExtCtrls, Data.DB;

type
  Tfm_pesq_vendedor = class(TForm)
    Panel1: TPanel;
    Panel2: TPanel;
    lbl_item: TLabel;
    rdg_opcao: TRadioGroup;
    edt_descricao: TEdit;
    btn_loc: TBitBtn;
    Panel3: TPanel;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    Panel4: TPanel;
    DBGrid1: TDBGrid;
    DataSource1: TDataSource;
    procedure FormShow(Sender: TObject);
    procedure DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
      DataCol: Integer; Column: TColumn; State: TGridDrawState);
    procedure btn_locClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  fm_pesq_vendedor: Tfm_pesq_vendedor;

implementation

{$R *.dfm}

uses U_dm_principal;

procedure Tfm_pesq_vendedor.btn_locClick(Sender: TObject);
begin
dm_principal.cds_vendedor.Close;
       dm_principal.sq_vendedor.SQL.Text:='select'
                                            +#13+'v.nome,'
                                            +#13+'v.dt_nasc,'
                                            +#13+'v.tipo_logradouro,'
                                            +#13+'v.logradouro,'
                                            +#13+'v.numero,'
                                            +#13+'v.bairro,'
                                            +#13+'v.ddd1,'
                                            +#13+'v.ddd2,'
                                            +#13+'v.tel1,'
                                            +#13+'v.tel2,'
                                            +#13+'v.email,'
                                            +#13+'v.home_page,'
                                            +#13+'v.hora,'
                                            +#13+'v.rg,'
                                            +#13+'v.apelido,'
                                            +#13+'v.data,'
                                            +#13+'v.cpf,'
                                            +#13+'v.obs,'
                                            +#13+'v.status,'
                                            +#13+'v.id,'
                                            +#13+'v.complemento,'
                                            +#13+'v.municipio,'
                                            +#13+'v.comissao,'
                                            +#13+'v.desc_max,'
                                            +#13+'v.uf_1,'
                                            +#13+'v.cep_1'
                                            +#13+'from vendedor v'
                                            +#13+' where v.nome <> ' + QuotedStr('') ;
         if  length(trim(edt_descricao.Text))>0 then
             dm_principal.sq_vendedor.SQL.Add(' and  v.nome containing '+QuotedStr(edt_descricao.Text));
             dm_principal.cds_vendedor.open;
end;

procedure Tfm_pesq_vendedor.DBGrid1DrawColumnCell(Sender: TObject;
  const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState);
var nLinha  : integer;


            
  begin

    begin
         Canvas.Font.Color:=clBlue;
         Canvas.Brush.Color:= $00F5F3F4;
    end
  end;





procedure Tfm_pesq_vendedor.FormShow(Sender: TObject);
begin
dm_principal.cds_vendedor.Open;
dm_principal.cds_fabricante.Open;
end;

end.
